import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { AddComponent } from './add/add.component';
import { EditComponent } from './edit/edit.component';
import { FileUploadComponent } from './file-upload/file-upload.component';
import { UserDetailComponent } from './user-detail/user-detail.component';
import { UsersDemoComponent } from './users-demo.component';

// Routing for lazy loading.
const routes: Routes = [
    {
        path: '',
        component: UsersDemoComponent
    },
    {
        path: 'detail/:id',
        component: UserDetailComponent
    },
    {
        path: 'edit/:id',
        component: EditComponent
    },
    {
        path: 'add',
        component: AddComponent
    },
    {
        path: 'file-upload',
        component: FileUploadComponent
    }
];

@NgModule({
    // Always call RouterModule.forChild in a feature-routing module.
    imports: [RouterModule.forChild(routes)],
    exports: [RouterModule]
})
export class UsersDemoRoutingModule { }